package com.lantu.draw.framework;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.opensymphony.xwork2.ActionSupport;
@InterceptorRefs({  
    @InterceptorRef("mydefaultStack")  
}) 
@Results( { @Result(name = "json", type = "json",params={"root","msg"})
})
public class BaseAction extends ActionSupport{
	private static Map msg = new HashMap<String, Object>();  
	static{
		msg.put("flag", "error");
	}
  
    public Map<String, Object> getMsg() {  
        return msg;  
    }  
	private static final long serialVersionUID = 1L;
	private int size;
	private int curPage;


	public int getSize() {
		return size;
	}

	public void setSize(final int size) {
		this.size = size;
	}

	public int getCurPage() {
		return curPage;
	}

	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}

	protected int getEndRow() {
		return size * curPage;
	}

	protected int getStartRow() {
		return size * curPage - size;
	}

	protected int getOffset() {
		return size * (curPage - 1);
	}

	protected int getLimit() {
		return size;
	}
	@Override
	public String execute() {
		return SUCCESS;
	}

}
